
//
//  MineAccountLoginOutCell.m
//  ShowYork
//
//  Created by hxh on 2020/8/26.
//  Copyright © 2020 hxh. All rights reserved.
//

#import "MineAccountLoginOutCell.h"

@interface MineAccountLoginOutCell ()
@property (nonatomic,strong)UIButton *loginoutBtn;
@end

@implementation MineAccountLoginOutCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUI];
    }
    return self;
}

- (void)setUI{
    
    self.backgroundColor = [UIColor whiteColor];
    
    self.loginoutBtn = [[UIButton alloc]init];
    [self.loginoutBtn setTitle:@"退出该帐号" forState:UIControlStateNormal];
    [self.loginoutBtn setTitleColor:RGBA(245, 75, 100, 1) forState:UIControlStateNormal];
    self.loginoutBtn.titleLabel.font = font(14);
    [self.loginoutBtn addTarget:self action:@selector(loginOutMethod) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.loginoutBtn];
    
    [self.loginoutBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.equalTo(self.contentView);
        make.height.mas_equalTo(44).priorityHigh();
    }];
}


- (void)loginOutMethod{
    if (self.delegate && [self.delegate respondsToSelector:@selector(loginOut)] ) {
        [self.delegate loginOut];
    }
}

+(instancetype)cellWithTableView:(UITableView *)tableView{
    NSString *ID = @"MineAccountLoginOutCell";
    MineAccountLoginOutCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[MineAccountLoginOutCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}

@end
